<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
	<style>
		.main{
			width:1200px;
			height:300px;
			/* background:#ccc; */
			margin:0 auto;

		}
		.left{
			padding:10px;
			width:550px;
			height:100%;
			
			float:left;
			border:1px dashed #000;
		}
		.right{
			padding:10px;
			width:550px;
			height:100%;
		
			float:right;
			border:1px dashed #000;
		}

		textarea{
			padding:5px;
			width:90%;
			height:100px;
		}
	</style>
</head>
<!-- 回到顶部 -->
<body>
	<img src="a.jpg" alt="" id='imgid'>
</body>
<script>	
	
	/*
	//不会出现图片宽高
	imgobj=document.getElementById('imgid');
	w=imgobj.clientWidth;
	h=imgobj.clientHeight;
	alert(w+'-'+h);*/
	/*window.onload=function(){//所有图片加载完毕
		imgobj=document.getElementById('imgid');
		w=imgobj.clientWidth;
		h=imgobj.clientHeight;
		alert(w+'-'+h);
	}*/
imgobj=document.getElementById('imgid');
window.onload=function(){//1张图片加载完毕
		
		w=imgobj.clientWidth;
		h=imgobj.clientHeight;
		alert(w+'-'+h);
	}
	

</script>
</html>